package com.eric.husky.dao;

import org.springframework.data.jpa.repository.JpaRepository;

import com.eric.husky.bean.User;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import javax.transaction.Transactional;
import java.util.List;

public interface UserDao extends JpaRepository<User, Integer>{
    List<User> findByPhone(@Param("phone")String phone);

    @Modifying
    @Query(value = "update user set password = :password where user_id = :userId",nativeQuery = true)
    int updatePwd (@Param("userId") Integer userId,@Param("password") String password);
}
